home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d963.lha
/
SIOD
/
scm
/
merge-sort.scm
< prev
next >
Wrap
Text File
|
1993-05-07
|
397b
|
11 lines
(define (merge x y test)
(cond ((null? x) y)
((null? y) x)
((test (car x) (car y)) (cons (car x) (merge (cdr x) y test)))
(else (cons (car y) (merge x (cdr y) test)))))
(define (merge-sort x test)
(cond ((null? (cdr x)) x)
(else (merge (list (car x) (cadr x))
(merge-sort (cddr x) test) test))))